﻿//cesium 三维的影响结构数据 -->
// 初始化地图

var videoplayer = (function () {
    // 初始化
    function videoplayer() {
        // 属性

    };
    videoplayer.prototype.resize = function (options) {
        console.info("fds");
        $("#" + this.idcc+"video").attr("width", $("#" + this.idcd).width()+"px");
        $("#" + this.idcc+"video").attr("height", $("#" + this.idcd).height()+"px");
    }
    ////
    videoplayer.prototype.init = function (options) {

        this.idcd = options.id;
        this.idcc = options.id + "video";
        var html = " <video id='" + this.idcc + "' class='video-js vjs-default-skin' controls preload='none' width='600px' height='242px' poster='http://vjs.zencdn.net/v/oceans.png' data-setup='{}'>"
            + "< source src= 'http://vjs.zencdn.net/v/oceans.mp4' type= 'video/mp4' >"
            + "<source src='http://vjs.zencdn.net/v/oceans.webm' type='video/webm'>"
            + "<source src='http://vjs.zencdn.net/v/oceans.ogv' type='video/ogg'>"
            + "<track kind='captions' src='../shared/example-captions.vtt' srclang='en' label='English'></track>"
            + "<!--Tracks need an ending tag thanks to IE9-->"
            + "<track kind='subtitles' src='../shared/example-captions.vtt' srclang='en' label='English'></track>"
            + "<!--Tracks need an ending tag thanks to IE9-->"
            + "<p class='vjs-no-js'>To view this video please enable JavaScript, and consider upgrading to a web browser that <a href='http://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a></p>"
            + "</video>";
        $("#" + options.id).html(html);
        var player = videojs(options.id + "video", {}, function () {
            console.log('Good to go!');
            //this.play(); // if you don't trust autoplay for some reason
        });
        player.on('play', function () {
            console.log('开始/恢复播放');
        });
        player.on('pause', function () {
            console.log('暂停播放');
        });
        player.on('ended', function () {
            console.log('结束播放');
        });
    }
    // 返回
    return videoplayer;
})();